/**
 * @param {string} s
 * @param {number} n
 * @return {boolean}
 */
var queryString = function (s, n) {
  let res
  for (let i = 1; i <= n; i++) {
    let temp = i
    res = ''
    while (temp != 0 && temp != 1) {
      res += temp % 2
      temp = Math.floor(temp / 2)
    }
    if (temp == 1) res += temp

    res = res.split('').reverse().join('')
    if (s.indexOf(res) == -1) return false
  }


  return true
};

console.log(queryString("110101011011000011011111000000",
  15));